package com.example.springbootlocal.utils.filter;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

/**
 * @author X.I.O
 * @title: FilterConfig
 * @projectName spring-boot-local
 * @description: TODO
 * @date 2021/11/14 20:16
 */
@Configuration
public class FilterConfig extends WebMvcConfigurerAdapter {

    @Autowired
    private GlobalInterceptor globalInterceptor;

    @Autowired
    private Interceptor interceptor;


    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(interceptor).addPathPatterns("/**");
        registry.addInterceptor(globalInterceptor).addPathPatterns("/**");
        super.addInterceptors(registry);
    }
}
